package summer_vacation.liqing;

/**
 * Created by 123456 on 2015/8/14.
 */
import java.util.Scanner;
public class Java20 {
    public static void main(String[] args) {
        int m=0,n=0;
        Scanner cin=new Scanner(System.in);
        String str=cin.nextLine();
        for(int i=0;i<str.length();i++){
            if (str.charAt(i)>'A'&&str.charAt(i)<='Z') m++;
            else n++;}
        if(m>n){
            System.out.println(m);
        } else
            System.out.println(n);
    }
}
